# https://github.com/gokcehan/lf/wiki
# https://pkg.go.dev/github.com/gokcehan/lf

set shell sh
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
set icons
set previewer ~/.config/lf/previewer.sh
set sixel

map x $$f
map X !$f
map D delete
map gi cd /run/media/adam
map gs cd /media/syncthing/adam/Marvin
map gn cd /media/nextcloud/me@cloud.apiote.xyz/
map <f-5> reload
map <f-2> rename $fx
map <enter> open $fx
map e edit $fx
map . set hidden!


cmd edit $fun edit "$fx"
cmd open $fun view "$fx"

cmd trash %set -f; mv $fx ~/.local/share/Trash/files/

cmd extract ${{
    set -f
    case $f in
        *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xzvf $f;;
        *.tar.gz|*.tgz) tar xzvf $f;;
        *.tar.xz|*.txz) tar xavf $f;;
        *.zip) unzip $f;;
        *.rar) unrar x $f;;
        *.7z) 7z x $f;;
    esac
}}

cmd tar ${{
    set -f
    mkdir $1
    cp -r $fx $1
    tar czf $1.tar.gz $1
    rm -rf $1
}}

cmd zip ${{
    set -f
    mkdir $1
    cp -r $fx $1
    zip -r $1.zip $1
    rm -rf $1
}}
